﻿using System;

namespace JingQiao.Ads.Domain.Model
{
    /// <summary>
    /// Contract for UnitOfWork pattern. For more
    /// references see http://martinfowler.com/eaaCatalog/unitOfWork.html or
    /// http://msdn.microsoft.com/en-us/magazine/dd882510.aspx
    /// In this solution sample Unit Of Work is implemented out-of-box in 
    /// ADO.NET DomainObject Framework persistence engine. But for academic
    /// purposed and for mantein PI ( Persistence Ignorant ) in Domain 
    /// this pattern is implemented.
    /// </summary>
    public interface IUnitOfWork
        :IDisposable
    {
        /// <summary>
        /// Commit all changes made in  a container 
        /// </summary>
        ///<param name="commitOption">
        ///<see cref="JingQiao.Ads.Domain.Model.CommitOption"/>
        ///</param>
        void Commit(CommitOption commitOption);

        /// <summary>
        /// Rollback changes not stored in databse at 
        /// this moment. See references of UnitOfWork pattern
        /// </summary>
        void RollbackChanges();

        /// <summary>
        /// Submit changes to data source
        /// </summary>
        void SubmitChanges();
    }
}
